Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement repo priorities. #112

Merged
merged 8 commits into from
Jul 8, 2024
Merged

Conversation

nguyen-phillip
Copy link
Collaborator

This adds an integer priority value to repo entries in repo config files. If not specified, a default priority of 500 is used.

These priorities are associated with package versions in the map returned by client.AvailableVersions. When looking for the latest version, client.FindRepoLatest takes priorities into account such that a package version from a higher priority repo will always compare greater than any package version from a lower priority repo.

During "googet install" the highest priority version will be installed if the package is not already installed, otherwise the install logic remains the same if the package is already installed.

During "googet update" versions with priority greater than the default priority of 500 will take precedence over installed versions. The highest priority version will be installed even if it means downgrading the installed version in order to facilitate rollbacks.

Drop the redundant NeedsInstallation check from install.FromRepo.
In all calls of FromRepo, prior checks have already been performed
and this extra check breaks priority rollbacks.
v2 string
want int
}{
{500, "1.2.3@1", 500, "1.2.3@2", -1},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a short description to each test case and print that when "got != tc.want"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@nguyen-phillip
Copy link
Collaborator Author

PTAL

@nguyen-phillip nguyen-phillip requested a review from adjackura April 8, 2024 06:41
@adjackura
Copy link
Collaborator

Can you rebase with the new repo changes (should be minor)

@nguyen-phillip
Copy link
Collaborator Author

Can you rebase with the new repo changes (should be minor)

Done. Sorry for the long delay, have been out on leave. Thanks for the review!

nguyen-phillip and others added 2 commits July 3, 2024 15:05
If the already installed version is the exact same as the version
available in a higher priority repo, then there is no reason to
reinstall that version. Also added tests for the updates code.
@nguyen-phillip
Copy link
Collaborator Author

PTAL: changed the updates logic to prevent unnecessary reinstalls and added some tests.

@nguyen-phillip nguyen-phillip requested a review from adjackura July 3, 2024 15:59
@adjackura adjackura merged commit 32a9293 into google:master Jul 8, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants